Recovering from an Invalid 您所在的位置:网站首页 spatial audio翻译 Recovering from an Invalid

Recovering from an Invalid

2024-05-10 19:16| 来源: 网络整理| 查看: 265

Recovering from an Invalid-Device Error (Spatial Sound) Article01/06/2021

Many of the methods of the Microsoft Spatial Audio API, such as ISpatialAudioClient, ISpatialAudioObjectRenderStream, and ISpatialAudioObject, return error codes if the audio endpoint device that the client application is using becomes invalid or the spatial audio rendering format is changed on the endpoint. These error codes indicates that the endpoint device has been unplugged, or that the audio hardware or associated hardware resources have been reconfigured, disabled, removed, spatial audio mode is changed or otherwise made unavailable for use. Frequently, the application can recover from this error.

Error codes that indicate an invalid-device error include the following:

SPTLAUDCLNT_E_DESTROYED AUDCLNT_E_DEVICE_INVALIDATED AUDCLNT_E_RESOURCES_INVALIDATED AUDCLNT_E_UNSUPPORTED_FORMAT SPTLAUDCLNT_E_INTERNAL Strategies for handling invalid-device errors

The recommended strategy for recovering from an invalid-device error depends on whether the application automatically selects a specific device based on internal requirements or it allows the user to explicitly select a device from a list of available devices.

Default audio device

If the application automatically selects the default device, use the following steps to recover.

Release the ISpatialAudioObjectRenderStream and ISpatialAudioClient interface and any other spatial audio interfaces that are used for rendering. Call IMMDeviceEnumerator::GetDefaultAudioEndpoint to get the current default audio device. Attempt to activate ISpatialAudioClient on the audio device. Activate ISpatialAudioObjectRenderStream. Specifically selected audio device

If the application selects a specific audio device, use the following steps to recover.

Release the ISpatialAudioObjectRenderStream interface and any other spatial audio interfaces that are used for rendering, but don't release ISpatialAudioClient. Use the current ISpatialAudioClient instance to activate ISpatialAudioObjectRenderStream.

Note that for both strategies listed above, the same steps can be applied to applications that use the ISpatialAudioObjectRenderStreamForMetadata or ISpatialAudioObjectRenderStreamForHrtf interfaces. Simply replace ISpatialAudioObjectRenderStream in the above steps with the metadata or Hrtf interfaces.

Related topics [Recovering from an Invalid-Device Error](recovering-from-an-invalid-device-error.md) [Stream Management](stream-management.md)

 

 



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有